#include "Server/include/Server.h"

int Server::run(){
    server_fd=socket(AF_INET,SOCK_STREAM,0);
    in_addr_t s;
    inet_pton(AF_INET,"127.0.0.1",(void*)&s);
    server_addr.sin_addr.s_addr=s;
    server_addr.sin_family=AF_INET;
    server_addr.sin_port=htons(PORT);
    if(bind(server_fd,(sockaddr*)&server_addr,sizeof(server_addr))<0){
        printf("bind err...\n");
        return -1;
    }
    if(listen(server_fd,1024)<0){
        printf("listen err...\n");
        return -1;
    }
    return 0;
}

